//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    isPlayingMusic:false
  },
  bgm: null,
  music_url: 'http://music.163.com/song/media/outer/url?id=557584888.mp3',
  music_coverImgUrl: '',
  onReady: function () {
    this.bgm = wx.getBackgroundAudioManager()
    this.bgm.title = '往后余生'
    this.bgm.epname = 'wedding'
    this.bgm.singer = '马良'
    this.bgm.coverImgUrl = this.music_coverImgUrl
    this.bgm.onCanplay(() => {
      this.bgm.pause()
    })
    
    this.bgm.src = this.music_url
  },
  
  play: function () {
    if (this.data.isPlayingMusic) {
      this.bgm.pause()
    } else {
      this.bgm.play()
    }
    this.setData({
      isPlayingMusic: !this.data.isPlayingMusic
    })
  },
  
  callGroom: function () {
    wx.makePhoneCall({
      phoneNumber: '123456'
    })
  },
  
  callBride: function () {
    wx.makePhoneCall({
      phoneNumber: '123456'
    })
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function () {
    console.log("JinxReport:onLoad")
  },
  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})
